cmake_minimum_required(VERSION 3.10)

project(xbot)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 11)

message(STATUS "CMake version: ${CMAKE_VERSION}")
message(STATUS "CMake Platform: ${CMAKE_SYSTEM_NAME}")
message(STATUS "CMake Generator: ${CMAKE_GENERATOR}")
message(STATUS "CMake Build Type: ${CMAKE_BUILD_TYPE}")
message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}")
message(STATUS "C Standard: ${CMAKE_C_STANDARD}")
message(STATUS "CMake C++ Compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS "CMake C Compiler: ${CMAKE_C_COMPILER}")
message(STATUS "Project name: ${PROJECT_NAME}")

option(CMAKE_EXPERIMENTAL_COMPILE_CACHE "Enable compile cache" ON)

file(GLOB SRC
    ${CMAKE_SOURCE_DIR}/*.cpp
    ${CMAKE_SOURCE_DIR}/*.h
    ${CMAKE_SOURCE_DIR}/*.hpp
    ${CMAKE_SOURCE_DIR}/hw/*.cpp
    ${CMAKE_SOURCE_DIR}/hw/*.h
    ${CMAKE_SOURCE_DIR}/hw/*.hpp
    ${CMAKE_SOURCE_DIR}/dev/*.cpp
    ${CMAKE_SOURCE_DIR}/dev/*.h
    ${CMAKE_SOURCE_DIR}/dev/*.hpp
    ${CMAKE_SOURCE_DIR}/cmds/*.cpp
    ${CMAKE_SOURCE_DIR}/cmds/*.h
    ${CMAKE_SOURCE_DIR}/cmds/*.hpp
    ${CMAKE_SOURCE_DIR}/utils/*.cpp
    ${CMAKE_SOURCE_DIR}/utils/*.h
    ${CMAKE_SOURCE_DIR}/utils/*.hpp
)

add_executable(${PROJECT_NAME})

add_subdirectory(3rd)
add_subdirectory(robospace)

target_sources(${PROJECT_NAME} PRIVATE 
    ${SRC}
)

target_include_directories(${PROJECT_NAME} PRIVATE 
    ${CMAKE_SOURCE_DIR}
    ${CMAKE_SOURCE_DIR}/3rd
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    3rd
    robospace
)

if(WIN32)
    target_link_libraries(${PROJECT_NAME} PRIVATE 
        winmm
        wsock32
        ws2_32
    )
endif()
